#pragma once
#include "stdafx.h"

class PRED
{
	Point m_p;
public:
	PRED(Point& p) :m_p(p) {};
	bool operator()(const Point& p)
	{
		return m_p <p;
	}
};

template<typename T>
inline void print_elem(const T& elem)
{
	std::cout << elem << " ";
	
}

template<typename T>
class Set_point
{
	T m_p;
public:
	Set_point(const T& p) :m_p(p) {};
	void operator()(T& p)
	{
		/*double x, y;
		p.GetAll(x, y);
		p.Set_All(x + m_p, y + m_p);*/

		p += m_p;
	}
};

class Find_point
{
	Point m_p;
public:
	Find_point(const Point& p) :m_p(p) {};
	bool operator()(Point& p)
	{
		return m_p == p;
	}
};

class Find_point_if
{
	double start,end;
public:
	Find_point_if(double s, double e) :start(s), end(e){};
	bool operator()(const Point& p)
	{
		double x = p.GetX();
		return x >= start && x <= end;
	}
};

inline Point Center(const Rect& r) { return r.Get_center(); }


inline bool Sort_distance_from (const Rect& r1, const Rect& r2)
{
	double x1, y1,x2,y2;
	r1.Get_center().GetAll(x1, y1);
	r2.Get_center().GetAll(x2, y2);
	return abs(x1 * x1) + abs(y1 * y1) > abs(x2 * x2) + abs(y2 * y2);
}

class Vector_leks
{
	char x;
	int& count;
public:
	Vector_leks(char ch, int& y) :x(ch), count(y){}
	/*int Get_count()const { return count; }*/
	bool operator()(const string& str) const { if (toupper(str[0]) == toupper(x)) { count++; return true; } else return false; }
};

inline bool how_many_days(pair<const string, int> month)
{
	return month.second & 1;
}

template<typename Container>
inline void print_container(const Container& cont)
{
	typename Container::const_iterator it_b = cont.begin(), it_end = cont.end();

	while (it_b != it_end)
	{
		std::cout << *it_b << " ";
		++it_b;
	}
	std::cout << std::endl;
}

template<typename T1, typename T2>
inline ostream& operator<<(ostream& os, const pair<const T1, T2>& T_p)
{
	os << endl << "moth: "<< T_p.first<<" days:" << T_p.second;
	return os;
}
